#!/usr/bin/env bash

set -ve

export LFS='/mnt/lfs'

_USER=`whoami`
if [ "$_USER" != "lfs" ];
then
    echo 'WARNING: User lfs ONLY!!!' && exit;
fi

################################# M4 ################################

cd $LFS/sources/
rm -rf m4-1.4.18/
tar -xvf m4-1.4.18.tar.xz
cd m4-1.4.18/

sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h

./configure --prefix=/tools
make
# 测试
make check
make install
